package ch.usi.inf.pf2.editor;

import ch.usi.inf.pf2.Sheet;
import ch.usi.inf.pf2.cell.Cell;
import junit.framework.TestCase;
/**
 * 
 * @author Lorenzo Baracchi <lorenzo.baracchi@usi.ch>
 *
 */
public class TestChangeCellLength extends TestCase
{
    private Sheet s;
    private Cell c;
    private ChangeCellLength chcb;
    
    protected void setUp()
    {
	   s= new Sheet();
	   s.initializeSheet();
	   c=s.getCell(1, 1);
	   c.setCellLength(5);
	   chcb = new ChangeCellLength(s, 1, 1, 10);
    }
    
    public void testEvaluate ()
    {
	   chcb.evaluate();
	   assertEquals(5, chcb.getOldLength());
	   assertEquals(10, chcb.getNewLength());
	   assertEquals(10, c.getCellLength());
    }
    
    public void testRestore ()
    {
	   chcb.evaluate();
	   chcb.restore();
	   assertEquals(5, chcb.getOldLength());
	   assertEquals(10, chcb.getNewLength());
	   assertEquals(5, c.getCellLength());
    }
}
